package com.example.netty_pipline.controller;

import com.example.netty_pipline.service.PipelineDemoService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

/**
 * Pipeline控制器 - 提供Web接口
 */
@RestController
@RequestMapping("/api/pipeline")
public class PipelineController {
    
    @Autowired
    private PipelineDemoService pipelineDemoService;
    
    /**
     * 处理消息
     */
    @PostMapping("/process")
    public String processMessage(@RequestBody String message) {
        pipelineDemoService.processMessage(message.getBytes());
        return "Message processed successfully";
    }
    
    /**
     * 获取Pipeline信息
     */
    @GetMapping("/info")
    public String getPipelineInfo() {
        return "Custom Pipeline System - Inspired by Netty Pipeline Architecture";
    }
}